package edu.fim.presentation.controller;

import java.util.ArrayList;
import java.util.List;

import edu.fim.core.exception.ServiceException;
import edu.fim.core.service.MealService;
import edu.fim.core.service.locator.BeanLocator;
import edu.fim.presentation.model.bean.Meal;

public class MealController {

	private List<Meal> meals;

	public MealController() {
		meals = new ArrayList<>();
	}

	public void add(Meal m) {
		meals.add(m);
	}

	public List<Meal> getMeals() {
		return meals;
	}
	
	public void insert(Meal meal) throws ServiceException {
		MealService service = BeanLocator.getInstance().getServiceBean(MealService.class);
		service.insert(meal);
	}
}